fix: i18n ICU expression ordering with pipes#5
Merged
Brooooooklyn merged 1 commit intomainfrom Feb 4, 2026
Merged
Conversation
R3Icu used HashMap for vars and placeholders, which does not preserve insertion order. JavaScript objects (used in Angular's ngtsc) do preserve insertion order. When ICU cases share interpolation expressions, the HashMap's non-deterministic iteration caused pipe expressions to be emitted before plain expressions in the i18nExp chain. Changed R3Icu.vars and R3Icu.placeholders from HashMap to ordered Vec<(Atom, ...)> with deduplication helpers matching JS object semantics. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
5cdc30b to
059b89f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
R3Icu used HashMap for vars and placeholders, which does not preserve insertion order. JavaScript objects (used in Angular's ngtsc) do preserve insertion order. When ICU cases share interpolation expressions, the HashMap's non-deterministic iteration caused pipe expressions to be emitted before plain expressions in the i18nExp chain.
Changed R3Icu.vars and R3Icu.placeholders from HashMap to ordered Vec<(Atom, ...)> with deduplication helpers matching JS object semantics.
Note
Medium Risk
Touches i18n/ICU compilation and changes ordering semantics used to generate update expressions, which could affect emitted templates for plural/select blocks. Scope is limited and covered by new ordering-focused integration tests.
Overview
Ensures deterministic i18n ICU expression ordering (especially when pipes are involved) by changing
R3Icu.varsandR3Icu.placeholdersfromHashMapto orderedVec<(Atom, ...)>.Updates the HTML→R3 ICU extraction to use ordered insert/update helpers that preserve first-insertion order (JS object semantics) while still de-duping keys, and adjusts tests to parse templates with expansion forms enabled plus new cases asserting
i18nExpchaining order for mixed plain/pipe expressions (including ICU plural).Written by Cursor Bugbot for commit 059b89f. This will update automatically on new commits. Configure here.